<template>
    <div>
        <span>b组件,a传的的数据为->{{msg}}</span>
    </div>
</template>

<script>
    import bus from './bus'
    export default {
        name: "qwer",
        data(){
            return{
                msg:""
            }
        },
        mounted() {
            bus.$on("aevent",(val)=>{
                //监听事件aevent，回调函数要使用箭头函数;
                console.log(val);//打印结果：我是a组件的数据
                this.msg = val;
            });
        }
    }
</script>

<style scoped>

</style>